﻿using System;
using System.Windows.Forms;
using CodePlex.DnD4eCampaignManager.Presentation;
using CodePlex.DnD4eCampaignManager.Presentation.ViewInterfaces;
using CodePlex.DnD4eCampaignManager.Repositories.Interfaces;

namespace CodePlex.DnD4eCampaignManager.ControlLibrary
{
    public partial class LocationControl : UserControl, ILocationView
    {
        public LocationControl(string locationName, ILocationRepository locationRepository)
        {
            InitializeComponent();
            Presenter = new LocationPresenter(locationName, this, locationRepository);
            Presenter.DisplayLocation();
        }

        public string LocationDescription
        {
            get { return _descriptionTextbox.Text; }
            set { _descriptionTextbox.Text = value; }
        }

        public string LocationDistances
        {
            get { return _distancesTextbox.Text; }
            set { _distancesTextbox.Text = value; }
        }

        public string LocationName
        {
            private get { return LocationNameText.Text; }
            set { LocationNameText.Text = value; }
        }

        public string LocationNPCs
        {
            get { return _npcsTextbox.Text; }
            set { _npcsTextbox.Text = value; }
        }

        private LocationPresenter Presenter { get; set; }

        private void SaveLocation_Click(object sender, EventArgs e)
        {
            Presenter.SaveLocation();
        }

        private void SetImageFileButton_Click(object sender, EventArgs e)
        {
            if ( selectLocationImageDialog.ShowDialog() == DialogResult.OK )
            {
            }
        }
    }
}